package com.vegetable.modules.entity.inbound;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 入库-代办交货商品表
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="AgentDeliveryDetail对象", description="入库-代办交货商品表")
public class AgentDeliveryDetail extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    // 移除了重复的id字段定义，因为已经从BaseEntity继承了该字段

    @ApiModelProperty(value = "生产者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long producerId = 11111L;

    @ApiModelProperty(value = "商品行序号")
    @TableField(exist = false)
    private Integer serialNumber;

    @ApiModelProperty(value = "主表id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long deliveryId;

    @ApiModelProperty(value = "订单来源0订货发货，1新建")
    private Integer orderSource;

    @ApiModelProperty(value = "商品ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long commodityId;

    @ApiModelProperty(value = "商品编码")
//    @TableField(exist = false)
    private String commodityCode;

    @ApiModelProperty(value = "商品名称")
    private String commodityName;

    @ApiModelProperty(value = "规格ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long specsId;

    @ApiModelProperty(value = "规格名称")
    private String specsName;

    @ApiModelProperty(value = "标准")
    private BigDecimal standard;

    @ApiModelProperty(value = "计划数量")
    private Integer planNumber;

    @ApiModelProperty(value = "计划重量")
    private BigDecimal planWeight;

    @ApiModelProperty(value = "实际数量")
    private Integer number;

    @ApiModelProperty(value = "本次入库数量")
    private Integer inNumber;

    @ApiModelProperty(value = "本次入库重量")
    private BigDecimal inWeight;

    @ApiModelProperty(value = "本次入库重量")
    private BigDecimal weightAdd;

    @ApiModelProperty(value = "剩余数量")
    private Integer surplusNumber;

    @ApiModelProperty(value = "剩余重量")
    private BigDecimal surplusWeight;

    @ApiModelProperty(value = "单价")
    private BigDecimal unitPrice;

    @ApiModelProperty(value = "模式：0公斤，1市斤（注意1公斤=2市斤）")
    private Integer mode;

    @ApiModelProperty(value = "实际重量（毛重）")
    private BigDecimal weight;

    @ApiModelProperty(value = "重量（标准*数量）")
    private BigDecimal actWeight;

    @ApiModelProperty(value = "损耗率")
    private BigDecimal lossRate;

    @ApiModelProperty(value = "损失重量（净重）")
    private BigDecimal lossWeight;

    @ApiModelProperty(value = "损失成本（损耗）")
    private BigDecimal lossCost;

    @ApiModelProperty(value = "商品金额")
    private BigDecimal goodsMoney = BigDecimal.ZERO;

    @ApiModelProperty(value = "交收数量")
    private Integer handInNumber;

    @ApiModelProperty(value = "交收重量")
    private Integer handInWeight;

    @ApiModelProperty(value = "交收成本")
    private BigDecimal handInCost;

    @ApiModelProperty(value = "完成交收")
    private BigDecimal finishHandIn;

    @ApiModelProperty(value = "商品总金额")
    private BigDecimal money;

    @ApiModelProperty(value = "总成本：总合计均摊到商品上后的商品合计")
    private BigDecimal cost;

    @ApiModelProperty(value = "标签：0按重，1按件")
    private Integer tags;

    @ApiModelProperty(value = "商品其他费用")
    @TableField(exist = false)
    private List<OrderCost> costs;

    @ApiModelProperty(value = "商品包装明细")
    @TableField(exist = false)
    private List<AgentDeliveryDetailPack> autoCosts;

    @ApiModelProperty(value = "商品包装费用汇总")
    private BigDecimal packMoney;

    @ApiModelProperty(value = "包装单价")
    @TableField(exist = false)
    private BigDecimal unitPackMoney;

    @ApiModelProperty(value = "代办人名称")
    @TableField(exist = false)
    private String agentName;

    @ApiModelProperty(value = "包装成本")
    @TableField(exist = false)
    private double packageCost;

    @ApiModelProperty(value = "包装成本-销售显示")
    @TableField(exist = false)
    private double packageCostForSales;

    @ApiModelProperty(value = "蔬菜成败")
    @TableField(exist = false)
    private BigDecimal costWeight;

    @ApiModelProperty(value = "支付完成标识0未对账，1已付款,2已对账未付款")
    private Integer isPayFinish;
    
    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private Integer sortOrder;
}